﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using WebVideo.Areas.Admin.Models;

namespace WebVideo.Areas.Admin.Controllers
{
    public class ProfileAdminController : Controller
    {
        //
        // GET: /Admin/ProfileAdmin/
           
        #region "Edit"
        public ActionResult Edit(string AD)
        {


            return View(ProfileAdminModel.LayModel(AD));

        }

        [ValidateInput(false)]
        [HttpPost]
        public ActionResult Edit(ProfileAdminModel AD)
        {

            try
            {
                if (ModelState.IsValid)
                {
                    ProfileAdminModel.Edit(AD);
                    return RedirectToAction("Index", "Home");
                }
            }
            catch
            {

                return RedirectToAction("Index", "Error", new { errorMsg = "Lỗi SQL hosting / server" });
            }
            return View(AD);
        }
        #endregion //Edit

        #region "Passw"
        public ActionResult Passw(string US)
        {
            ProfileAdminModel tnew = new ProfileAdminModel();
            return View(ProfileAdminModel.LayModelPass(US));
        }

        [ValidateInput(false)]
        [HttpPost]
        public ActionResult Passw(ProfileAdminModel Mtnew)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ProfileAdminModel.Passw(Mtnew);
                    return RedirectToAction("Index", "Home");
                }
            }
            catch
            {
                return RedirectToAction("Index", "Error", new { errorMsg = "Lỗi SQL hosting / server" });
            }
            return View(Mtnew);
        }
        #endregion //Passw
       

    }
}
